import { createStore } from 'vuex'
import getters from './getters'
// 创建一个新的 store 实例
const modulesFiles = import.meta.globEager('./modules/*.js')

let modules = {}
for (const path in modulesFiles) {
	const moduleName = path.replace(/(.*\/)*([^.]+).*/gi, '$2')
	modules = { ...modules, [moduleName]: modulesFiles[path].default }
}
const store = createStore({
	getters,
	modules,
})

export default store
